﻿namespace WpInsights.Core
{
    using System.IO;
    using System.Reflection;

    class ResourceReader
    {
        /// <summary>
        ///     Loads the specified manifest resource from this assembly Resources folder
        /// </summary>
        /// <param name="fileName">The case-sensitive name of the manifest resource in Resources folder being requested</param>
        /// <returns>Resource content</returns>
        internal static string ReadToEnd(string fileName)
        {
            string result = string.Empty;
            using (
                Stream stream =
                    Assembly.GetExecutingAssembly().GetManifestResourceStream("WpInsights.Core.Resources." + fileName))
            {
                if (stream != null)
                {
                    result = new StreamReader(stream).ReadToEnd();
                }
            }

            return result;
        }

    }
}
